package stv5.abstracted;

import java.util.Collection;
import java.util.HashMap;

import stv5.Series;

/**
 * The Database for the SeriesTracker holds all the series
 * 	to be tracked and the relevant tracking information. It
 * 	need not know anything about the episodes themselves,
 * 	nor necessarily where the episodes are located.
 * 
 * TODO: Create a FlatFileDatabase class
 *  
 * @author Daniel
 *
 */
public interface Database {
	
	public static final int DEFAULT_OLD_DURATION = 60*60*24*30;
	public static final int[] DEFAULT_OLD_COLOR = new int[]{0x33, 0x33, 0x33};
	public static final int[] DEFAULT_NEW_COLOR = new int[]{0xcc, 0x99, 0x00};
	public static final String DEFAULT_OLD_COLOR_S = "333333";
	public static final String DEFAULT_NEW_COLOR_S = "CC9900";	

	/**
	 * (Re)load all series from the database
	 * 
	 * @return A Collection of all Series that are
	 * 	tracked in the database
	 */
	public abstract Collection<Series> reloadSeries();

	/**
	 * Rebuild the database, using the data provided by seriesData. 
	 * 	If deleteOld is true, then any series NOT in seriesData
	 * 	will be removed from the DB before the update.
	 * 
	 * @param seriesData A HashMap with the names of the series
	 * 	as the key, and a guid with which to locate the series
	 * 	as the value 
	 * @param deleteOld
	 */
	public abstract void rebuildDb(HashMap<String, String> seriesData,
			boolean deleteOld);

	/**
	 * Replace the old values in the database for the series 
	 * 	represented by currSeries with the new values it contains. 
	 * 
	 * @param currSeries
	 */
	public abstract void updateSeries(Series currSeries);

	public int loadOldDuration();

	public int[] loadNewColor();

	public int[] loadOldColor();

	/**
	 * @return The configured path for the local video player
	 */
	public String loadLocalPlayer();

	public Series getSeries(int seriesId);

	public boolean hasSeries(int seriesId);

	public boolean hasSeries(String folder);

	public Collection<Series> getSeries();

	public int createNewId();

}